<template class="page-apply-detail">
  <van-row>
    <van-nav-bar
      left-text="返回"
      :title="apply ? '加分申请详情' : '新建加分申请'"
      @click-left="$emit('onCancel')"/>
    <template v-if="apply && applyDetail">
      <panel-raise-modify v-if="apply.apply_status === $vo.ApplyStatus.MODIFY && operateType === $vo.OperateType.APPLY" :assessType="assessType" :apply="applyDetail" @onConfirm="$emit('onConfirm')"/>
      <panel-raise-info v-else :apply="applyDetail"/>
<!--      <panel-raise-info v-if="operateType !== $vo.OperateType.APPLY" :apply="applyDetail"/>-->
      <!-- <template v-if="operateType !== $vo.OperateType.APPLY">
        <panel-raise-approve :apply="applyDetail" :assessType="assessType" v-if="operateType === $vo.OperateType.CHECK && apply.apply_status === $vo.ApplyStatus.CREATE" @onConfirm="$emit('onConfirm')"/>
        <panel-raise-recheck :apply="applyDetail" v-if="operateType === $vo.OperateType.RECHECK && apply.apply_status === $vo.ApplyStatus.REVIEW" @onConfirm="$emit('onConfirm')"/>
        <panel-raise-review :apply="applyDetail" v-if="operateType === $vo.OperateType.REVIEW && apply.apply_status === $vo.ApplyStatus.CHECK" @onConfirm="$emit('onConfirm')"/>
      </template> -->
    </template>
    <!-- <template v-if="!apply">
      <panel-raise-create  :assessType="assessType" @onConfirm="$emit('onConfirm')"/>
    </template> -->
    <panel-history-process :historys="applyDetail ? applyDetail.history : []"/>
  </van-row>
</template>


<script>
import PanelRaiseInfo from '@/views/common/panel/PanelRaiseInfo'
// import PanelRaiseCreate from '@/views/common/panel/PanelRaiseCreate'
// import PanelRaiseApprove from '@/views/common/panel/PanelRaiseApprove'
// import PanelRaiseRecheck from '@/views/common/panel/PanelRaiseRecheck'
// import PanelRaiseReview from '@/views/common/panel/PanelRaiseReview'
import PanelHistoryProcess from '@/views/common/panel/PanelHistoryProcess'
// import PanelRaiseModify from '@/views/common/panel/PanelRaiseModify'
 import { getAddApplyDetail } from '@/api/assess'
export default {
  name: 'PageRaiseDetail',
  // components: { PanelRaiseInfo, PanelRaiseCreate, PanelRaiseApprove, PanelRaiseRecheck, PanelRaiseReview, PanelHistoryProcess, PanelRaiseModify },
  components: { PanelRaiseInfo, PanelHistoryProcess },
  // props: ['apply', 'assessType', 'operateType'],
  props: ['apply'],
  data () {
    return {
      isLoading: false,
      applyDetail: null,
      carrier: this.$vo.createCarrier()
    }
  },
  mounted () {
    if (this.apply) {
      this.isLoading = true
      getAddApplyDetail(this.apply.id).then(res => {
        this.isLoading = false
        let { data } = res
        if (data[this.$response.CODE] === this.$response.SUCCESS) {
          this.applyDetail = data[this.$response.DATA]
          this.carrier = JSON.parse(this.applyDetail.apply_inst.carrier_item)
        } else {
          this.$toast.fail('获取数据失败：' + data[this.$response.MESSAGE])
        }
      }, errFunc => {
        this.isLoading = false
        this.$notify('服务调用失败：' + errFunc.toString())
        console.log(errFunc.toString())
      })
    }
  },
  methods: {

  }
}
</script>

<style scoped lang="less">

</style>
